//#include "customwebengineview.h"

//CustomWebEngineView::CustomWebEngineView(QWidget *parent)
//    : QWebEngineView(parent) {}

//QWebEngineView* CustomWebEngineView::createWindow(QWebEnginePage::WebWindowType type) {
//    Q_UNUSED(type);

//    auto *newWebView = new CustomWebEngineView();
//    auto *newWindow = new QMainWindow();
//    newWindow->setCentralWidget(newWebView);
//    newWindow->setWindowState(Qt::WindowFullScreen);
//    newWindow->show();

//    return newWebView;
//}


// ----------------------------
//#include "customwebengineview.h"

//CustomWebEngineView::CustomWebEngineView(QWidget *parent)
//    : QWebEngineView(parent) {
//    // 设置默认页面，无需调用 profile()
//    setPage(new QWebEnginePage(this));
//}

//QWebEngineView* CustomWebEngineView::createWindow(QWebEnginePage::WebWindowType type) {
//    Q_UNUSED(type);

//    // 创建新的 WebView
//    auto *newWebView = new CustomWebEngineView();
//    newWebView->setWindowState(Qt::WindowFullScreen);
//    newWebView->show();

//    return newWebView;
//}


// ----------------------------------

#include "customwebengineview.h"

CustomWebEngineView::CustomWebEngineView(QWidget *parent)
    : QWebEngineView(parent) {}

QWebEngineView* CustomWebEngineView::createWindow(QWebEnginePage::WebWindowType type) {
    Q_UNUSED(type);

    // 点击链接时返回当前的 QWebEngineView，确保在同一个窗口中加载
    return this;
}
